import request from '@/utils/request'

export interface LoginParams {
  username: string
  password: string
}

export interface RegisterParams extends LoginParams {
  email: string
  phone?: string
}
export const login = (data: LoginParams) => {
  return request.post('/api/auth/login', data)
}

export const register = (data: RegisterParams) => {
  return request.post('/api/auth/register', data)
}

export const logout = () => {
  return request.post('/api/auth/logout')
}

export const getUserInfo = () => {
  return request.get('/api/auth/current')
}
